package com.neusoft.elmboot.controller;

import java.math.BigDecimal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.Integral;
import com.neusoft.elmboot.service.IntegralService;

@RestController
@RequestMapping("/IntegralController")
@CrossOrigin
public class IntegralController {

    @Autowired
    IntegralService integralService;

    @RequestMapping("/saveIntegral")
    public int saveIntegral(String userId) throws Exception{
        return integralService.saveIntegral(userId);
    }

    @RequestMapping("/getIntegralByUserid")
    public Integral getIntegralByUserid(String userId) throws Exception{
        return integralService.getIntegralByUserid(userId);
    }

    @RequestMapping("/updateCount")
    public int updateCount(String userId, BigDecimal count) throws Exception{
        return integralService.updateCount(userId, count);
    }
}
